<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
<!-- android.qdoc -->
  <title>Getting Started with Qt for Android | Qt 5.14</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td ><a href="index.html">Qt 5.14</a></td><td >Getting Started with Qt for Android</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.14.2 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#installing-the-prerequisites">Installing the Prerequisites</a></li>
<li class="level2"><a href="#updating-the-android-sdk">Updating the Android SDK</a></li>
<li class="level1"><a href="#configuring-your-development-host">Configuring Your Development Host</a></li>
<li class="level2"><a href="#windows">Windows</a></li>
<li class="level2"><a href="#64-bit-linux">64-bit Linux</a></li>
<li class="level2"><a href="#qt-creator-ide">Qt Creator IDE</a></li>
<li class="level1"><a href="#testing-your-setup">Testing Your Setup</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">Getting Started with Qt for Android</h1>
<span class="subtitle"></span>
<!-- $$$android-getting-started.html-description -->
<div class="descr"> <a name="details"></a>
<a name="installing-the-prerequisites"></a>
<h2 id="installing-the-prerequisites">Installing the Prerequisites</h2>
<p>In order to use <a href="android.html">Qt for Android</a>, you need the following:</p>
<ul>
<li><a href="http://developer.android.com/sdk/index.html">The Android SDK Tools</a><p><b>Note: </b>If your Qt version is earlier than v5.9, use the SDK tools package v25.2&#x2e;5 or earlier.</p></li>
<li><a href="http://developer.android.com/tools/sdk/ndk/index.html">The Android NDK</a><ul>
<li>Qt 5.11 and below<ul>
<li>NDK r10e</li>
<li>GCC toolchain</li>
</ul>
</li>
<li>Qt 5.12.0 to 5.12.5 and Qt 5.13.0 to 5.13.1<ul>
<li>NDK r19c</li>
<li><i>android-clang</i></li>
</ul>
</li>
<li>Qt 5.14+, Qt 5.13.2+ and Qt 5.12.6+<ul>
<li>NDK r20b or r21</li>
<li><i>android-clang</i></li>
<li><p><b>Note: </b>Qt 5.14.0 and 5.14.1 with NDK r21 have a bug fixed at <a href="https://bugreports.qt.io/browse/QTBUG-81461">QTBUG-81461</a>.</p></li>
</ul>
</li>
</ul>
</li>
<li><a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html">Java SE Development Kit</a> (JDK) v6 or later. You can also use <a href="http://openjdk.java.net">OpenJDK</a> on Linux.</li>
</ul>
<p>After installing these tools, update the Android SDK by installing the API and build tools packages required for development. You can install these packages either through Android Studio or using the command line tools package you installed earlier. For more details, refer to the <a href="https://developer.android.com/studio/intro/update.html">Android Studio</a> documentation.</p>
<p><b>Note: </b>Make sure to unpack the Android SDK and NDK to a writeable location that Qt Creator can access later. Otherwise, Qt Creator won't be able to use <code>sdkmanager</code> or find all components even if they were installed manually.</p><a name="updating-the-android-sdk"></a>
<h3 id="updating-the-android-sdk">Updating the Android SDK</h3>
<p>The command line tools provided by the Android SDK Tools package also enables updating the SDK, but without a GUI. For example, the following command on Ubuntu updates the SDK by installing the latest <code>build-tools</code>, <code>platform-tools</code>, <code>emulator</code>, and <code>patcher</code> packages:</p>
<pre class="cpp plain">

  ./bin/sdkmanager --update

</pre>
<p>To install a specific package, use <code>sdkmanager</code> from <code>&lt;ANDROID_SDK_ROOT&gt;/tools/bin</code>. For example, the following command installs the <code>android-10</code> platforms package on Ubuntu:</p>
<pre class="cpp plain">

  ./sdkmanager &quot;platforms;android-10&quot;

</pre>
<p>For more details, refer to the <a href="https://developer.android.com/studio/command-line/sdkmanager.html">sdkmanager</a> documentation.</p>
<a name="configuring-your-development-host"></a>
<h2 id="configuring-your-development-host">Configuring Your Development Host</h2>
<a name="windows"></a>
<h3 id="windows">Windows</h3>
<p>The default USB driver on Windows does not allow debugging using Android Debug Bridge (ADB) tool. You must install the additional USB driver provided by the <i>extras</i> Android SDK package. Use the following command from the Windows command prompt to install the extras package:</p>
<pre class="cpp plain">

  sdkmanager.bat &quot;extras;google;usb_driver&quot;

</pre>
<p>After the package installation is complete, install the driver from <code>&lt;ANDROID_SDK_ROOT&gt;/extras/google/usb_driver</code>. Try running a few basic <a href="http://developer.android.com/tools/help/adb.html">adb</a> commands now and check whether your Android device responds to it.</p>
<a name="64-bit-linux"></a>
<h3 id="64-bit-linux">64-bit Linux</h3>
<p>If you're developing on a 64-bit Linux machine, you must install the following dependencies in order to run 32-bit executables like <code>adb</code>, which allows Qt Creator to find devices to deploy to:</p>
<pre class="cpp plain">

  sudo apt-get install libstdc++6:i386 libgcc1:i386 zlib1g:i386 libncurses5:i386

</pre>
<p>To run the emulator, the following dependencies are also necessary:</p>
<pre class="cpp">

  sudo apt<span class="operator">-</span>get install libsdl1<span class="operator">.</span><span class="number">2debian</span>:i386

</pre>
<a name="qt-creator-ide"></a>
<h3 id="qt-creator-ide">Qt Creator IDE</h3>
<p>The Qt Creator IDE that came with the Qt 5 installation on your development host, must be configured to enable developing applications for Android. Launch Qt Creator and select <b>Tools</b> &gt; <b>Options</b> &gt; <b>Devices</b> &gt; <b>Android</b> to add the Android NDK and SDK paths. For more details, refer to <a href="http://doc.qt.io/qtcreator/creator-developing-android.html">Qt Creator Manual</a>.</p>
<a name="testing-your-setup"></a>
<h2 id="testing-your-setup">Testing Your Setup</h2>
<p>Now you can test your development setup by running the examples that came with the Qt 5 installation. You can browse these examples in Qt Creator <b>Welcome</b> mode. Use the <code>android</code> filter in the search field to list all the examples tested on Android.</p>
<p>To develop a simple application from scratch, see <a href="http://doc.qt.io/qtcreator/qt-creator-accelbubble-example.html">Creating a Mobile Application</a>.</p>
</div>
<!-- @@@android-getting-started.html -->
        </div>
       </div>
   </div>
   </div>
</div>
<div class="footer">
   <p>
   <acronym title="Copyright">&copy;</acronym> 2020 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br/>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br/>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>
